#include "PerturbMutation.hh"


void PerturbMutation::mutate(Solution *solution) {

    IntArraySolution *arraySolution = (IntArraySolution *)solution;

    for (int i = 0; i < IntArraySolution::getSize(); i++) {
        if (Random::getInstance()->flip(probability)) {
            if (arraySolution->get(i) == 1) arraySolution->set(i, 0);

            else arraySolution->set(i, 1);

        }
    }


}


